#include"LuckyNumber.h"
#include"Proxy.h"
#include<typeinfo>
using namespace std;

int main()
{
    unique_ptr<LuckyNumber>number(new LuckyNumber());
    auto* proxy = new Proxy(number.get());
    while (1)
    {
        cout << "Input an animal name:" << endl;
        string animal;
        cin >> animal;
        if (!proxy->Access(animal)) {
            cout << "There is not such an animal" << endl;
            continue;
        }
        cout << "Input 1 to show LuckyNumber; Input 2 to insert it to Black List; Input 3 to delete it from the Black List" << endl;
        int choise;
        cin >> choise;
        if (choise == 2) {
            if (proxy->checkBlack(animal))
                cout << "It was already in the Black List" << endl;
            else
                proxy->insertBlack(animal);
        }
        else if (choise == 3) {
            if (!proxy->checkBlack(animal))
                cout << "It is not in the Black List" << endl;
            else
                proxy->delBlack(animal);
        }
        else if (choise == 1 && proxy->checkBlack(animal)) {
            cout << "The animal is in the Black List" << endl;
        }
        else if (choise == 1 && !proxy->checkBlack(animal)) {
            cout << proxy->generate(animal) << endl;
        }
        else
            cout << "Error" << endl;
        if (choise == 0) {
            cin.clear(); //clear bad input flag
            cin.ignore(numeric_limits<streamsize>::max(), '\n'); //discard input
            continue;
        }
    }
    return 0;
}